package extends2modifier;

public class Fu {
    //1private:只能在本类中访问
    private void privateMethod()
    {
        System.out.println("privateMethod()");
    }
    //2缺省：本类、本包都可以访问
    void method()
    {
        System.out.println("method()");
    }
    //3protected:本类、本包、子类都可以访问
    protected void protectedMethod()
    {
        System.out.println("protectedMethod()");
    }
    //4public:任何类都可以访问
    public void publicMethod()
    {
        System.out.println("publicMethod()");
    }

    public static void main(String[] args) {
        Fu fu = new Fu();
        fu.privateMethod();
        fu.method();
        fu.protectedMethod();
        fu.publicMethod();
    }
}
